package com.mxpio.erp.quality.service.impl;

import com.mxpio.erp.common.enums.OrderStatusEnums;
import com.mxpio.erp.common.quality.entity.InspectionScheme;
import com.mxpio.erp.common.quality.service.InspectionSchemeService;
import com.mxpioframework.common.vo.Result;
import com.mxpioframework.security.util.SecurityUtils;
import com.mxpioframework.system.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

@Service
public class InspectionSchemeServiceImpl extends BaseServiceImpl<InspectionScheme> implements InspectionSchemeService {
    @Override
    @Transactional
    public Result<InspectionScheme> updateBpmnStatus(InspectionScheme inspectionScheme, OrderStatusEnums.BpmnStatus auditing) {
        inspectionScheme.setBpmnStatus(auditing.getStatusCode());
        inspectionScheme.setReviewer(SecurityUtils.getLoginUsername());
        inspectionScheme.setReviewTime(new Date());
        this.update(inspectionScheme);
        return Result.OK();
    }
}
